﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

namespace AIC_CS
{
    public partial class UCMenu : System.Web.UI.UserControl
    {
        protected int MenuItem
        {
            get { return GetTaiLieuMenu().Rows.Count; }
        }

        protected DataRowCollection MenuTable
        {
            get { return GetTaiLieuMenu().Rows; }
        }
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void lbtLogOut_Click(object sender, EventArgs e)
        {
            if (Request.Cookies["userInfo"] != null)
            {
                HttpCookie myCookie = new HttpCookie("userInfo");
                myCookie.Expires = DateTime.Now.AddDays(-1d);
                Response.Cookies.Add(myCookie);
            }
            Session.Clear();
            Response.Redirect("Index.aspx");
        }
        protected DataTable GetTaiLieuMenu()
        {
            return SqlHelper.ExecuteDataTable(CommandType.Text, "SELECT * FROM dbo.tblDanhMuc WHERE MaDM = 'TaiLieuID1_DM'");
        }
    }
}